<?

function conv_leadingZero($number, $dec = 2)
{
  while(strlen($number) < $dec)
    $number = '0'.$number;
  return($number);
}

function conv_charCount($char, $heystack)
{
  $result = 0;
  for ($a = 0; $a < strlen($heystack); $a++)
  {
    if ($char == substr($heystack, $a, 1)) $result++;
  }
  return($result);
}

function conv_addArrayItems($srcArray, &$toArray)
{
  if (is_array($srcArray))
    foreach ($srcArray as $k => $v)
      $toArray[$k] = $v;
}

function conv_addListItems(&$toArray, $srcArray)
{
  if (is_array($srcArray))
    foreach ($srcArray as $v)
      $toArray[] = $v;
  $toArray = array_unique($toArray);
}

// get a dump string of an array
function getArrayDump(&$array)
{
  ob_start();
  print_r($array);
  return (str_replace("\n", "\r\n", ob_get_clean()));
}


?>